<?php

class Admin_JobController extends Kieumau_Controller_Kieumauadmin
{
	
	protected 	$fieldsValidate = array();
	
    public function init()
    {
		parent::init();
    	try{
    		$dirTemplate = TEMPLATE_PATH;
    		$sectionConfig = 'template';
    		$fileConfig = 'default/template.ini';
    		$this->createTemplate($dirTemplate, $sectionConfig, $fileConfig );
    		
    	}catch(Exception $ex){
    		echo "error: ".$ex->getMessage();
    		die;
    	}
    }
	
	// @author: Peter.Nguyen
	// @data: 5/25/2012
    public function indexAction()
    {
        // action body
		
    }
	
	// @author: Peter.Nguyen
	// @data: 5/18/2012
    public function listAction(){
		
		$user_table = new Admin_Model_DbTable_Group();
		$resultUser = $user_table->listGroupUser();
		$page = $this->_getParam ( 'page', 1 );
		$paginator = Zend_Paginator::factory ( $resultUser );
		$paginator->setItemCountPerPage ( 10 );
		$paginator->setCurrentPageNumber ( $page );
		
		$this->view->paginator = $paginator;

	}
	
	// @author: Peter.Nguyen
	// @data: 5/18/2012
    public function delAction(){
		// No need view ...
		$this->_helper->layout->disableLayout ();
     	$this->_helper->viewRenderer->setNoRender ();
		
		$status = array();
		$id = $this->getRequest()->getParam('id');
		$user_table = new Admin_Model_DbTable_Group();
		$status['status'] = $user_table->deleteTable($id);
		echo json_encode($status);
		exit();
		
	}	
	
	// @author: Peter.Nguyen
	// @data: 5/18/2012
    public function addAction(){
					
		// Get data;
		$jobTable = new Admin_Model_DbTable_Job();
		
		$jobTable->insertTable();


	}
}

